README for: Taking Variance Seriously: Visualizing the Statistical and Substantive Significance of ARCH-GARCH Models
Authors: Allyson Benton, Soren Jordan, Andrew Philips
Last updated: 5/20/24
------------------------------------------------------------------------------


NOTES: 
	 1) Below are the files, datasets and ancillary files needed to replicate the manuscript and SI. Because the simulations can take a very long time (especially for the Monte Carlos, which take about 2 weeks to run!), those wishing to quickly replicate the figures/tables can use the pre-simulated datasets and the following files:
	--To replicate the Monte Carlo analysis: create-plots-postMC
	--To replicate Figure 1: [Figure 1 must be replicated using the steps below and must be simulated first]
	--To replicate all Hellwig example figures: hellwig-makeplots.do
	--To replicate all Schneider-Troeger example figures: schneider-troeger-makeplots.do
	
	 2) In previous GARCH work (https://dataverse.harvard.edu/file.xhtml?persistentId=doi:10.7910/DVN/8JHA2X/PBNTBG&version=1.2) we have found that due to differences in the operating system and types of Stata, results can differ very slightly, especially in calculating standard errors. Users trying to get the exact same output should use Stata MP (version 18.0) for an Intel Mac.
	 
	 3) Users will need to set their Stata graphics scheme to “burd” to replicate figures (via ”findit scheme burd”) to obtain identical figure schemes. Other necessary ancillary programs in R and Stata are discussed below in the "ancillary programs" section.
	 
	 4) Some files use Stata’s ‘preserve’, ‘restore’ and ‘local’ functions. Users will need to run all lines as a single do command when necessary to avoid such information being lost from memory
	 
	 5) Because there are so many files calling to each other, it's advised to keep the same folder directory format in the current zipped replication (just change all the top-level working directories)
	 


Files:
	 --- CODEBOOK ---
	 codebook.xlsx contains codebooks of variable names for the two replication example datasets (ukdata1.dta for Hellwig, and st-data.xlsx for Schneider-Troeger).

	 --- FILES FOR THE MONTE CARLO ANALYSIS ---
	1. call-mcs.do
		Description: call all the monte carlo files: garch-mc-norm-experiment1, garch-mc-norm-experiment2, garch-mc-t-experiment3, garch-mc-t-experiment4. [WARNING...call-mcs.do takes a very long time to run]
		Inputs/required files: garch-mc-norm-experiment1, garch-mc-norm-experiment2, garch-mc-t-experiment3, garch-mc-t-experiment4, delta-method (and their ancillary files described below)
		Outputs: (all specific outputs for each experiment are described below)
		
	2. garch-mc-norm-experiment1.do
		Description: Monte Carlo experiment 1 data generation files (T=250, \nu_t ~ N(0,1)). This files is called by call-mcs.do.
		Inputs/required files: synthgarch.ado, bootr2.ado, bootrone.ado, rscript
		Outputs: dgp_scenario1.dta, dgp_scenario1_BASEPRED.dta, dgp_scenario1_PBSPRED.dta, dgp_scenario1_MEPRED.dta, dgp_scenario1_RESIDPRED.dta
	
	3. garch-mc-norm-experiment2.do
		Description: Monte Carlo experiment 2 data generation files (T=1000, \nu_t ~ N(0,1)). This files is called by call-mcs.do.
		Inputs/required files: synthgarch.ado, bootr2.ado, bootrone.ado, rscript
		Outputs: dgp_scenario2_BASEPRED.dta, dgp_scenario2_PBSPRED, dgp_scenario2_MEPRED.dta, dgp_scenario2_RESIDPRED.dta
		
	4. garch-mc-t-experiment3.do
		Description: Monte Carlo experiment 3 data generation files (T=250, \nu_t ~ t(2)). This files is called by call-mcs.do.
		Inputs/required files: synthgarch.ado, bootr2.ado, bootrone.ado, rscript
		Outputs: dgp_scenario1t_BASEPRED.dta, dgp_scenario1t_PBSPRED.dta, dgp_scenario1t_MEPRED.dta, dgp_scenario1t_RESIDPRED.dta
		
	5. garch-mc-t-experiment4.do
		Description: Monte Carlo experiment 4 data generation files (T=1000, \nu_t ~ t(2)). This files is called by call-mcs.do.
		Inputs/required files: synthgarch.ado, bootr2.ado, bootrone.ado, rscript
		Outputs: dgp_scenario2t_BASEPRED.dta, dgp_scenario2t_PBSPRED.dta, dgp_scenario2t_MEPRED.dta, dgp_scenario2t_RESIDPRED.dta
		
	6. delta-method.do
		Description: Monte Carlo experiments I-IV carried out using the delta method only. This file is called by call-mcs.do
		Inputs/required files: synthgarch.ado
		Outputs: dgp_scenario1_DELTAPRED.dta, dgp_scenario2_DELTAPRED.dta, dgp_scenario1t_DELTAPRED.dta, dgp_scenario2t_DELTAPRED.dta
		
	7. create-plots-postMC.do
		Description: Joins together all Monte Carlo datasets and creates figures/tables.
		Inputs/required files: dgp_scenario1.dta, dgp_scenario1_BASEPRED.dta, dgp_scenario1_PBSPRED.dta, dgp_scenario1_MEPRED.dta, dgp_scenario1_RESIDPRED.dta, dgp_scenario2_BASEPRED.dta, dgp_scenario2_PBSPRED, dgp_scenario2_MEPRED.dta, dgp_scenario2_RESIDPRED.dta, dgp_scenario1t_BASEPRED.dta, dgp_scenario1t_PBSPRED.dta, dgp_scenario1t_MEPRED.dta, dgp_scenario1t_RESIDPRED.dta, dgp_scenario2t_BASEPRED.dta, dgp_scenario2t_PBSPRED.dta, dgp_scenario2t_MEPRED.dta, dgp_scenario2t_RESIDPRED.dta, dgp_scenario1_DELTAPRED.dta, dgp_scenario2_DELTAPRED.dta, dgp_scenario1t_DELTAPRED.dta, dgp_scenario2t_DELTAPRED.dta
		Outputs: Table SM.1, Figure SM.7, Figure SM.8, Figure SM.9, Figure SM.10
	
	
		
	 --- FILES FOR FIGURE 1 ---

	6. fig1-simulate-data.R
		Description: simulate GARCH data in R that is used by file fig1-estimate-garch to create Figure 1.
		Inputs/required files: none
		Outputs: simulated_wide.dta
		
	7. fig1-estimate-garch.do
		Description: creates a series of folders containing estimated GARCH predictions to be used in file fig1-plot-garch to create Figure 1.
		Inputs/required files: simulated_wide.dta
		Outputs: a large number of datasets saved in the data/figure1-data directory
		
	8. fig1-plot-garch.R:
		Description: uses the files from fig1-simulate-data.R and fig1-estimate-garch.do to create Figure 1.
		Inputs/required files: simulated_wide.dta and a large number of datasets saved in the data/figure1-data directory
		Outputs: Figure 1 in main manuscript
		
		
		
	 --- FILES FOR APPLIED EXAMPLE HELLWIG ---
	 
	9. hellwig-me.R: 
		Description: performs maximum entropy bootstrap for Hellwig example.
		Inputs/required files: ukdata1.dta
		Outputs: hellwig-me.csv
		
	10. hellwig-create-Bs.do:
		Description: bootstraps/estimates GARCH models using bootstrapping approaches for Hellwig example. Also makes Figure SM 3.
		Inputs/required files: ukdata1.dta, hellwig-me.csv, bootr2.ado, bootrone.ado
		Outputs: betas-parametric.dta, betas-me.dta, betas-resid.dta, Figure SM 3 (a and b)
		
	11. hellwig-makeplots.do:
		Description: uses 3 saved bootstrapped datasets to make plots for Hellwig example. Also incorporates delta method.
		Inputs/required files:betas-parametric.dta, betas-me.dta, betas-resid.dta, ukdata1.dta
		Output: Table 2, Figure SM.11, Figure SM.12, Figure SM.1, Figure 2, Figure SM.13, Figure SM.14, Figure SM.15, Figure SM.2, Figure 3, Figure SM.16
		
		
		
		
	 --- FILES FOR APPLIED EXAMPLE SCHNEIDER-TROEGER ---
	 
	12. schneider-troeger-me.R:
		Description: performs maximum entropy bootstrap for Schneider-Troeger example.
		Inputs/required files: st-data.xlsx
		Outputs: schneider-troeger-me.csv
	
	13. schneider-troeger-create-Bs.do:
		Description: bootstraps/estimates GARCH models using bootstrapping approaches for Schneider-Troeger example.
		Inputs/required files: st-data.xlsx, schneider-troeger-me.csv, bootr2.ado, bootrone.ado
		Outputs: schneider-troeger-betas-parametric.dta, schneider-troeger-betas-me.dta, schneider-troeger-betas-resid.dta
	
	14. schneider-troeger-makeplots.do:
		Description: uses saved bootstrapped datasets to make plots for Schneider-Troeger example.
		Inputs/required files: st-data.xlsx, schneider-troeger-betas-parametric.dta, schneider-troeger-betas-me.dta, schneider-troeger-betas-resid.dta
		Output: Table 3, Figure SM.4, Figure SM.5, Figure SM.6, Figure SM.17, Figure SM.18, Figure 4, Figure SM.19, Figure SM.20, Figure SM.21, Figure 5, Figure SM.22


	--- ANCILLARY PROGRAMS ---
	15. synthgarch.ado
		Description: command generates y and sigma2 based on inputs. Called in the monte carlo experiment files
	
	16. rscript
		Description: user-written Stata package needed for calling R. Must have on computer (type "findit rscript" in Stata console to install)
		
	17. bootr2.ado
		Description: command to create a residual-based bootstrap
		
	18. bootrone.ado
		Description: command to create a bootstrapped starting value of Y and sigma2
		
	19. me-call.R
		Description: command that creates maximum entropy bootstraps in R. Requires `haven`, `meboot` packages in R